package dao;

import java.util.List;
import java.util.Map;

import entity.Category;

@SuppressWarnings("unchecked")
public class CategoryDao extends DangDao{

	protected String getNameSpace() {
		return Category.class.getSimpleName().toLowerCase();
	}
	
	
	public List<Map<String, Object>> queryAllCategoryByParentId(Integer pid) throws Exception {
		return (List<Map<String, Object>>) queryForList("findAllCategoryByParentId", pid);
	}
	
	/**
	 * book_list.jsp左栏信息
	 * @return
	 */
	public List<Map<String, Object>> querySubCategoryInfo(Integer parent_id) throws Exception{
		return (List<Map<String, Object>>) queryForList("querySubCategoryInfo", parent_id);
	}
	
	public Category queryCategoryById(Integer id) throws Exception{
		return (Category) queryForObject("queryCategoryById", id);
	}
}
